home *** CD-ROM | disk | FTP | other *** search
- VERSION 2.00
- Begin Form Calculator
- BackColor = &H00000000&
- BorderStyle = 3 'Fixed Double
- Caption = "Calculator"
- ClientHeight = 4140
- ClientLeft = 2745
- ClientTop = 2085
- ClientWidth = 3705
- ClipControls = 0 'False
- ControlBox = 0 'False
- FontBold = -1 'True
- FontItalic = 0 'False
- FontName = "System"
- FontSize = 9.75
- FontStrikethru = 0 'False
- FontUnderline = 0 'False
- Height = 4545
- Icon = CALC.FRX:0000
- Left = 2685
- LinkMode = 1 'Source
- LinkTopic = "Form1"
- MaxButton = 0 'False
- ScaleHeight = 4140
- ScaleWidth = 3705
- Top = 1740
- Width = 3825
- Begin SSPanel Panel3D2
- BackColor = &H00C0C0C0&
- BevelInner = 1 'Inset
- BevelWidth = 2
- BorderWidth = 6
- Font3D = 0 'None
- ForeColor = &H00000000&
- Height = 3915
- Left = 75
- TabIndex = 1
- Top = 105
- Width = 3555
- Begin SSPanel Panel3D5
- BackColor = &H00C0C0C0&
- BevelInner = 1 'Inset
- BorderWidth = 1
- Font3D = 0 'None
- ForeColor = &H00000000&
- Height = 375
- Left = 210
- ShadowColor = 1 'Black
- TabIndex = 24
- Top = 195
- Width = 1035
- Begin SSPanel Panel3D7
- BackColor = &H0000FF00&
- BevelInner = 2 'Raised
- BevelOuter = 0 'None
- BevelWidth = 2
- BorderWidth = 1
- Caption = "ON"
- Font3D = 1 'Raised w/light shading
- FontBold = -1 'True
- FontItalic = 0 'False
- FontName = "Arial"
- FontSize = 8.25
- FontStrikethru = 0 'False
- FontUnderline = 0 'False
- ForeColor = &H00000000&
- Height = 285
- Left = 60
- ShadowColor = 1 'Black
- TabIndex = 25
- Top = 60
- Width = 450
- End
- Begin SSPanel Panel3D6
- BevelOuter = 0 'None
- BorderWidth = 1
- Caption = "OFF"
- Font3D = 3 'Inset w/light shading
- FontBold = -1 'True
- FontItalic = 0 'False
- FontName = "Arial"
- FontSize = 8.25
- FontStrikethru = 0 'False
- FontUnderline = 0 'False
- ForeColor = &H000000FF&
- Height = 210
- Left = 570
- ShadowColor = 1 'Black
- TabIndex = 26
- Top = 90
- Width = 375
- End
- End
- Begin SSPanel Panel3D4
- BevelInner = 1 'Inset
- BorderWidth = 1
- Caption = "CZAPPATRONICS"
- Font3D = 2 'Raised w/heavy shading
- ForeColor = &H00FF0000&
- Height = 390
- Left = 1290
- ShadowColor = 1 'Black
- TabIndex = 23
- Top = 180
- Width = 2070
- End
- Begin SSPanel Panel3D3
- BackColor = &H00000000&
- BevelOuter = 1 'Inset
- BevelWidth = 2
- BorderWidth = 2
- Font3D = 2 'Raised w/heavy shading
- ForeColor = &H00FF0000&
- Height = 525
- Left = 210
- TabIndex = 22
- Top = 615
- Width = 3150
- Begin Label ReadOut
- Alignment = 1 'Right Justify
- BackColor = &H0000FFFF&
- BorderStyle = 1 'Fixed Single
- Caption = "0."
- FontBold = -1 'True
- FontItalic = 0 'False
- FontName = "MS Sans Serif"
- FontSize = 13.5
- FontStrikethru = 0 'False
- FontUnderline = 0 'False
- Height = 420
- Left = 45
- TabIndex = 2
- Top = 60
- Width = 3075
- End
- End
- Begin SSPanel Panel3D1
- BackColor = &H00808080&
- BevelInner = 2 'Raised
- BorderWidth = 1
- Font3D = 2 'Raised w/heavy shading
- ForeColor = &H00FF0000&
- Height = 2520
- Left = 210
- TabIndex = 3
- Top = 1170
- Width = 3165
- Begin CommandButton Number
- BackColor = &H00C0C0C0&
- Caption = "7"
- FontBold = -1 'True
- FontItalic = 0 'False
- FontName = "System"
- FontSize = 9.75
- FontStrikethru = 0 'False
- FontUnderline = 0 'False
- Height = 480
- Index = 7
- Left = 90
- TabIndex = 0
- Top = 135
- Width = 480
- End
- Begin CommandButton Number
- BackColor = &H00C0C0C0&
- Caption = "8"
- FontBold = -1 'True
- FontItalic = 0 'False
- FontName = "System"
- FontSize = 9.75
- FontStrikethru = 0 'False
- FontUnderline = 0 'False
- Height = 480
- Index = 8
- Left = 690
- TabIndex = 21
- Top = 135
- Width = 480
- End
- Begin CommandButton Number
- BackColor = &H00C0C0C0&
- Caption = "9"
- FontBold = -1 'True
- FontItalic = 0 'False
- FontName = "System"
- FontSize = 9.75
- FontStrikethru = 0 'False
- FontUnderline = 0 'False
- Height = 480
- Index = 9
- Left = 1290
- TabIndex = 20
- Top = 135
- Width = 480
- End
- Begin CommandButton Cancel
- BackColor = &H00C0C0C0&
- Caption = "C"
- FontBold = -1 'True
- FontItalic = 0 'False
- FontName = "System"
- FontSize = 9.75
- FontStrikethru = 0 'False
- FontUnderline = 0 'False
- Height = 480
- Left = 2010
- TabIndex = 19
- Top = 135
- Width = 480
- End
- Begin CommandButton CancelEntry
- BackColor = &H0000FFFF&
- Caption = "CE"
- FontBold = -1 'True
- FontItalic = 0 'False
- FontName = "System"
- FontSize = 9.75
- FontStrikethru = 0 'False
- FontUnderline = 0 'False
- Height = 480
- Left = 2610
- TabIndex = 18
- Top = 135
- Width = 480
- End
- Begin CommandButton Number
- BackColor = &H00C0C0C0&
- Caption = "4"
- FontBold = -1 'True
- FontItalic = 0 'False
- FontName = "System"
- FontSize = 9.75
- FontStrikethru = 0 'False
- FontUnderline = 0 'False
- Height = 480
- Index = 4
- Left = 90
- TabIndex = 17
- Top = 735
- Width = 480
- End
- Begin CommandButton Number
- BackColor = &H00C0C0C0&
- Caption = "5"
- FontBold = -1 'True
- FontItalic = 0 'False
- FontName = "System"
- FontSize = 9.75
- FontStrikethru = 0 'False
- FontUnderline = 0 'False
- Height = 480
- Index = 5
- Left = 690
- TabIndex = 16
- Top = 735
- Width = 480
- End
- Begin CommandButton Number
- BackColor = &H00C0C0C0&
- Caption = "6"
- FontBold = -1 'True
- FontItalic = 0 'False
- FontName = "System"
- FontSize = 9.75
- FontStrikethru = 0 'False
- FontUnderline = 0 'False
- Height = 480
- Index = 6
- Left = 1290
- TabIndex = 15
- Top = 735
- Width = 480
- End
- Begin CommandButton Operator
- BackColor = &H00C0C0C0&
- Caption = "+"
- FontBold = -1 'True
- FontItalic = 0 'False
- FontName = "System"
- FontSize = 9.75
- FontStrikethru = 0 'False
- FontUnderline = 0 'False
- Height = 480
- Index = 1
- Left = 2010
- TabIndex = 14
- Top = 735
- Width = 480
- End
- Begin CommandButton Operator
- BackColor = &H00C0C0C0&
- Caption = "-"
- FontBold = -1 'True
- FontItalic = 0 'False
- FontName = "System"
- FontSize = 9.75
- FontStrikethru = 0 'False
- FontUnderline = 0 'False
- Height = 480
- Index = 3
- Left = 2610
- TabIndex = 13
- Top = 735
- Width = 480
- End
- Begin CommandButton Number
- BackColor = &H00C0C0C0&
- Caption = "1"
- FontBold = -1 'True
- FontItalic = 0 'False
- FontName = "System"
- FontSize = 9.75
- FontStrikethru = 0 'False
- FontUnderline = 0 'False
- Height = 480
- Index = 1
- Left = 90
- TabIndex = 12
- Top = 1335
- Width = 480
- End
- Begin CommandButton Number
- BackColor = &H00C0C0C0&
- Caption = "2"
- FontBold = -1 'True
- FontItalic = 0 'False
- FontName = "System"
- FontSize = 9.75
- FontStrikethru = 0 'False
- FontUnderline = 0 'False
- Height = 480
- Index = 2
- Left = 690
- TabIndex = 11
- Top = 1335
- Width = 480
- End
- Begin CommandButton Number
- BackColor = &H00C0C0C0&
- Caption = "3"
- FontBold = -1 'True
- FontItalic = 0 'False
- FontName = "System"
- FontSize = 9.75
- FontStrikethru = 0 'False
- FontUnderline = 0 'False
- Height = 480
- Index = 3
- Left = 1290
- TabIndex = 10
- Top = 1335
- Width = 480
- End
- Begin CommandButton Operator
- BackColor = &H00C0C0C0&
- Caption = "X"
- FontBold = -1 'True
- FontItalic = 0 'False
- FontName = "System"
- FontSize = 9.75
- FontStrikethru = 0 'False
- FontUnderline = 0 'False
- Height = 480
- Index = 2
- Left = 2010
- TabIndex = 9
- Top = 1335
- Width = 480
- End
- Begin CommandButton Operator
- BackColor = &H00C0C0C0&
- Caption = "/"
- FontBold = -1 'True
- FontItalic = 0 'False
- FontName = "System"
- FontSize = 9.75
- FontStrikethru = 0 'False
- FontUnderline = 0 'False
- Height = 480
- Index = 0
- Left = 2610
- TabIndex = 8
- Top = 1335
- Width = 480
- End
- Begin CommandButton Number
- BackColor = &H00C0C0C0&
- Caption = "0"
- FontBold = -1 'True
- FontItalic = 0 'False
- FontName = "System"
- FontSize = 9.75
- FontStrikethru = 0 'False
- FontUnderline = 0 'False
- Height = 480
- Index = 0
- Left = 90
- TabIndex = 7
- Top = 1935
- Width = 1080
- End
- Begin CommandButton Decimal
- BackColor = &H00C0C0C0&
- Caption = "."
- FontBold = -1 'True
- FontItalic = 0 'False
- FontName = "System"
- FontSize = 9.75
- FontStrikethru = 0 'False
- FontUnderline = 0 'False
- Height = 480
- Left = 1290
- TabIndex = 6
- Top = 1935
- Width = 480
- End
- Begin CommandButton Operator
- BackColor = &H00C0C0C0&
- Caption = "="
- FontBold = -1 'True
- FontItalic = 0 'False
- FontName = "System"
- FontSize = 9.75
- FontStrikethru = 0 'False
- FontUnderline = 0 'False
- Height = 480
- Index = 4
- Left = 2010
- TabIndex = 5
- Top = 1935
- Width = 480
- End
- Begin CommandButton Percent
- BackColor = &H00C0C0C0&
- Caption = "%"
- FontBold = -1 'True
- FontItalic = 0 'False
- FontName = "System"
- FontSize = 9.75
- FontStrikethru = 0 'False
- FontUnderline = 0 'False
- Height = 480
- Left = 2610
- TabIndex = 4
- Top = 1935
- Width = 480
- End
- End
- End
- ' ------------------------------------------------------------------------
- ' Copyright (C) 1991 Microsoft Corporation
- ' You have a royalty-free right to use, modify, reproduce and distribute
- ' the Sample Application Files (and/or any modified version) in any way
- ' you find useful, provided that you agree that Microsoft has no warranty,
- ' obligations or liability for any Sample Application Files.
- ' ------------------------------------------------------------------------
- Option Explicit
- Dim Op1, Op2 ' Previously input operand.
- Dim DecimalFlag As Integer ' Decimal point present yet?
- Dim NumOps As Integer ' Number of operands.
- Dim LastInput ' Indicate type of last keypress.
- Dim OpFlag ' Indicate pending operation.
- Dim TempReadout
- Dim MouseDownFlag As Integer
- Dim Counter As Integer
- ' Click event procedure for C (cancel) key.
- ' Reset the display and initializes variables.
- Sub Cancel_Click ()
- ReadOut = "0."
- Op1 = 0
- Op2 = 0
- Form_Load
- End Sub
- ' Click event procedure for CE (cancel entry) key.
- Sub CancelEntry_Click ()
- ReadOut = "0."
- DecimalFlag = False
- LastInput = "CE"
- End Sub
- ' Click event procedure for decimal point (.) key.
- ' If last keypress was an operator, initialize
- ' readout to "0." Otherwise, append a decimal
- ' point to the display.
- Sub Decimal_Click ()
- If LastInput = "NEG" Then
- ReadOut = "-0."
- ElseIf LastInput <> "NUMS" Then
- ReadOut = "0."
- End If
- DecimalFlag = True
- LastInput = "NUMS"
- End Sub
- ' Initialization routine for the form.
- ' Set all variables to initial values.
- Sub Form_Load ()
- DecimalFlag = False
- NumOps = 0
- LastInput = "NONE"
- OpFlag = " "
- End Sub
- ' Click event procedure for number keys (0-9).
- ' Appends new number to the number in the display.
- Sub Number_Click (Index As Integer)
- If LastInput <> "NUMS" Then
- ReadOut = "."
- DecimalFlag = False
- End If
- If DecimalFlag Then
- ReadOut = ReadOut + Number(Index).Caption
- Else
- ReadOut = Left(ReadOut, InStr(ReadOut, ".") - 1) + Number(Index).Caption + "."
- End If
- If LastInput = "NEG" Then ReadOut = "-" & ReadOut
- LastInput = "NUMS"
- End Sub
- ' Click event procedure for operator keys (+, -, x, /, =).
- ' If the immediately preceeding keypress was part of a
- ' number, increment NumOps. If one operand is present,
- ' set Op1. If two are present, set Op1 equal to the
- ' result of the operation on Op1 and the current
- ' input string, and display the result.
- Sub Operator_Click (Index As Integer)
- TempReadout = ReadOut
- If LastInput = "NUMS" Then
- NumOps = NumOps + 1
- End If
- Select Case NumOps
- Case 0
- If Operator(Index).Caption = "-" And LastInput <> "NEG" Then
- ReadOut = "-" & ReadOut
- LastInput = "NEG"
- End If
- Case 1
- Op1 = ReadOut
- If Operator(Index).Caption = "-" And LastInput <> "NUMS" And OpFlag <> "=" Then
- ReadOut = "-"
- LastInput = "NEG"
- End If
- Case 2
- Op2 = TempReadout
- Select Case OpFlag
- Case "+"
- Op1 = Val(Op1) + Val(Op2)
- Case "-"
- Op1 = Op1 - Op2
- Case "X"
- Op1 = Op1 * Op2
- Case "/"
- If Op2 = 0 Then
- MsgBox "Can't divide by zero", 48, "Calculator"
- Else
- Op1 = Op1 / Op2
- End If
- Case "="
- Op1 = Op2
- Case "%"
- Op1 = Op1 * Op2
- End Select
- ReadOut = Op1
- NumOps = 1
- End Select
- If LastInput <> "NEG" Then
- LastInput = "OPS"
- OpFlag = Operator(Index).Caption
- End If
- End Sub
- Sub Panel3D7_MouseDown (Button As Integer, Shift As Integer, x As Single, Y As Single)
- MouseDownFlag = True
- panel3d7.Font3D = 4
- End Sub
- Sub Panel3D7_MouseMove (Button As Integer, Shift As Integer, x As Single, Y As Single)
- If MouseDownFlag = True Then
- If Counter > 10 Then
- panel3d7.Left = x '+ (Command3d1.Width/4)
- Counter = 0
- If x > 400 Then
- End
- End If
- Else
- Counter = Counter + 1
- End If
- End If
- End Sub
- Sub Panel3D7_MouseUp (Button As Integer, Shift As Integer, x As Single, Y As Single)
- MouseDownFlag = False
- panel3d7.Font3D = 1
- End Sub
- ' Click event procedure for percent key (%).
- ' Compute and display a percentage of the first operand.
- Sub Percent_Click ()
- ReadOut = ReadOut / 100
- LastInput = "Ops"
- OpFlag = "%"
- NumOps = NumOps + 1
- DecimalFlag = True
- End Sub
-